@echo off
echo ========================================
echo Java基础学习示例 - 运行脚本
echo ========================================
echo.

:menu
echo 请选择要运行的示例:
echo 1. 基础语法示例
echo 2. 集合框架示例  
echo 3. 异常处理示例
echo 4. 运行单元测试
echo 5. 启动Spring Boot应用
echo 6. 编译项目
echo 7. 清理项目
echo 0. 退出
echo.

set /p choice=请输入选项 (0-7): 

if "%choice%"=="1" goto basic
if "%choice%"=="2" goto collections
if "%choice%"=="3" goto exception
if "%choice%"=="4" goto test
if "%choice%"=="5" goto springboot
if "%choice%"=="6" goto compile
if "%choice%"=="7" goto clean
if "%choice%"=="0" goto exit
goto menu

:basic
echo.
echo 运行基础语法示例...
mvn exec:java -Dexec.mainClass="com.example.basics.BasicSyntaxExamples"
echo.
pause
goto menu

:collections
echo.
echo 运行集合框架示例...
mvn exec:java -Dexec.mainClass="com.example.collections.CollectionExamples"
echo.
pause
goto menu

:exception
echo.
echo 运行异常处理示例...
mvn exec:java -Dexec.mainClass="com.example.exception.ExceptionExamples"
echo.
pause
goto menu

:test
echo.
echo 运行单元测试...
mvn test
echo.
pause
goto menu

:springboot
echo.
echo 启动Spring Boot应用...
echo 应用启动后，访问 http://localhost:8080/api/users
echo 按 Ctrl+C 停止应用
mvn spring-boot:run
echo.
pause
goto menu

:compile
echo.
echo 编译项目...
mvn clean compile
echo.
pause
goto menu

:clean
echo.
echo 清理项目...
mvn clean
echo.
pause
goto menu

:exit
echo.
echo 感谢使用Java基础学习示例！
pause 